Primitive Class Color

Represents an RGBA or RGB color.

Components are specified as values clamped to the range [0, 255].

Members

r (int) Red component.
g (int) Green component.
b (int) Blue component.
a (int) Alpha component (0 = invisible, 255 = opaque).

Functions

Color([R], [G], [B], [A]) Create a Color object.
__tostring(color)


Members

r
(int) Red component.
g
(int) Green component.
b
(int) Blue component.
a
(int) Alpha component (0 = invisible, 255 = opaque).

Functions

Color([R], [G], [B], [A])
Create a Color object.

Parameters:

  • R int Red component. Default: 128.
  • G int Green component. Default: 128.
  • B int Blue component. Default: 128.
  • A int Alpha (transparency) component. Default: 255.

Returns:

    Color A new Color object.

Usage:

    local color1 = TEN.Color()               -- Default gray color (128, 128, 128, 255)
    local color2 = TEN.Color(255, 0, 0)      -- Red color with full opacity (255, 0, 0, 255)
    local color3 = TEN.Color(0, 255, 0, 128) -- Green color with 50% opacity
__tostring(color)

Parameters:

  • color Color This color.

Returns:

    string A string representing R, G, B, and A values.
generated by TEN-LDoc (a fork of LDoc 1.4.6)